package com.davidhigenbottam.HeatMap.shared;

import java.util.ArrayList;

public class Province implements Result {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	Long id;
	String name;
	double val=0d;
	boolean hasValue = false;
	ColourBand colourBand;
	ArrayList<Institution> institutions;
	
	public Province(){
	}
	
	public Province(String name){
		this(0L, name,0f, false);
	}
	public Province(String name, double val){
		this(0L, name,val, true);
	}
	public Province(Long provId, String name) {
		this(provId, name,0f, false);
	}
	
	
	public Province( Long id, String name, double val, boolean hasValue){
		this.id= id;
		this.name=name;
		this.val=val;
		this.hasValue= hasValue;
		this.colourBand= ColourBand.FIRST;
	}
	

	public String getValueDescription(){
		if(hasValue){
			return String.valueOf((double)Math.round(getVal()*100d)/100);
		}
		else
			return "0";//no data
	}
	
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getVal() {
		return val;
	}

	public void setVal(double val) {
		this.val = val;
		this.hasValue= true;
	}
	
	public boolean hasValue() {
		return hasValue;
	}
	public void setHasValue(boolean hasValue) {
		this.hasValue = hasValue;
	}
	public ColourBand getColourBand() {
		return colourBand;
	}
	public void setColourBand(ColourBand colourBand) {
		this.colourBand = colourBand;
	}
	
	public void addInstitution(Institution i){
		if(institutions==null)
			institutions= new ArrayList<Institution>();
		
		institutions.add(i);
	}
	public ArrayList<Institution> getInstitutions(){
		return institutions;
	}
}